<?php

declare (strict_types=1);
namespace App\Model;

/**
 * @property int $id
 * @property int $pid 属性ID
 * @property string $value 属性值
 * @property int $cid 分类ID
 * @property string $create_time
 * @property string $update_time
 */
class GPropertyValue extends Model {
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'g_property_value';

    /**
     * 根据分类ID获取属性值
     * @param $cid
     * @return \Hyperf\Database\Model\Builder[]|\Hyperf\Database\Model\Collection
     */
    public static function getValues($cid) {
        return self::query()
            ->where('cid', $cid)
            ->select('id', 'pid', 'value')
            ->get();
    }
}
